home *** CD-ROM | disk | FTP | other *** search
- /* ---------------------------------------------------------------------------------------------
- PICT display CDEF This control
- definition simply displays a picture in
- the control rectangle. It is not a
- picture button CDEF, in fact it does
- not respond to mouse clicks at all.
-
- The resource ID of the PICT is given as the initial "value".
- If there is a variation code other than 0, the rectangle will also
- be framed, with a thickness given by the variation code.
- ---------------------------------------------------------------------------------------------
- */
-
-
- pascal long main(
- short varcode, // thickness of frame.
- ControlHandle cntl_h,
- short message,
- long param )
- {
- long result;
- Rect bounding_box;
- PicHandle pict_h;
- SignedByte pict_state;
- RgnHandle bounds_rgn;
-
- result = 0;
- bounding_box = (**cntl_h).contrlRect;
-
- switch (message)
- {
- case drawCntl:
- if ((**cntl_h).contrlVis == 0)
- break; // nothing to draw
-
- pict_h = GetPicture( (**cntl_h).contrlValue );
- if (pict_h)
- {
- PenNormal();
- pict_state = HGetState( (Handle) pict_h );
- HNoPurge( (Handle) pict_h );
- DrawPicture( pict_h, &bounding_box );
- if (varcode > 0)
- {
- PenSize( varcode, varcode );
- FrameRect( &bounding_box );
- PenNormal();
- }
- HSetState( (Handle) pict_h, pict_state );
- }
- break;
-
- case testCntl:
- /*
- We do nothing here, so that if someone
- clicks on the control, nothing happens.
- If you do the obvious thing, return a part
- code if the mouse is in the bounding
- rectangle, then clicking on the control
- brings it to the front. That would
- make it impossible to use this as a
- background picture.
- */
- break;
-
- case calcCntlRgn:
- result = 1; // Tells Cntl Mgr we handle this message
- case calcCRgns:
- RectRgn( (RgnHandle) param, &bounding_box );
- break;
- }
-
- return result;
- }
-